/*
 *
 * Created on: 14.07.2012
 *
 * DHConfig.h
 * This file is part of KOBUS
 * 
 * Copyright (C) 2012 - Ivan Penkin, MIPT
 * grek.penkin@gmail.com
 *
 * KOBUS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * KOBUS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with KOBUS; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, 
 * Boston, MA  02110-1301  USA
 *  
 */

#ifndef DHCONFIG_H_
#define DHCONFIG_H_


#include <KobusCommon.h>

namespace kobus {
namespace dhcp {

class DHConfig: public Config
{
  public:
    explicit
    DHConfig(QObject * parent = 0);
    DHConfig(const QString & /* cfgPath */, QObject * parent = 0);

    bool check() const;

    K_CONFIG_KEYS_BEGIN;
      K_CONFIG_SECTION_BEGIN(daemon, daemon);
        K_CONFIG_DECLARE_KEY(user, user);
        K_CONFIG_DECLARE_KEY(group, group);
      K_CONFIG_SECTION_END;
      K_CONFIG_SECTION_BEGIN(connection, connection);
        K_CONFIG_DECLARE_KEY(id, id);
        K_CONFIG_DECLARE_KEY(coreAddr, core-address);
        K_CONFIG_DECLARE_KEY(corePort, core-port);
        K_CONFIG_DECLARE_KEY(coreKey, core-key);
      K_CONFIG_SECTION_END;
      K_CONFIG_SECTION_BEGIN(dhcpLog, dhcp-log);
        K_CONFIG_DECLARE_KEY(logPath, log-path);
        K_CONFIG_DECLARE_KEY(allowedIfaces, allowed-ifaces);
      K_CONFIG_SECTION_END;
      K_CONFIG_SECTION_BEGIN(ackPraser, ack-parser);
        K_CONFIG_DECLARE_KEY(ackRegex, ack-regex);
        K_CONFIG_DECLARE_KEY(ifaceGrp, iface-group);
        K_CONFIG_DECLARE_KEY(vlanGrp, vlan-group);
        K_CONFIG_DECLARE_KEY(macGrp, mac-group);
        K_CONFIG_DECLARE_KEY(ipGrp, ip-group);
        K_CONFIG_DECLARE_KEY(remoteIdGrp, remote-id-group);
        K_CONFIG_DECLARE_KEY(circuitIdGrp, circuit-id-group);
      K_CONFIG_SECTION_END;
      K_CONFIG_SECTION_BEGIN(releaseParser, release-parser);
        K_CONFIG_DECLARE_KEY(releaseRegex, release-regex);
        K_CONFIG_DECLARE_KEY(macGrp, mac-group);
        K_CONFIG_DECLARE_KEY(ipGrp, ip-group);
      K_CONFIG_SECTION_END;
    K_CONFIG_KEYS_END;

    static const int MAX_GROUP_NUM = 127;
    static const int MIN_NONOPTIONAL_GROUP_NUM = 1;
    static const int MIN_OPTIONAL_GROUP_NUM = -1;

  private:
    Q_DISABLE_COPY(DHConfig);

    static int confKeysCounter;
};

} /* namespace dhcp */
} /* namespace kobus */


#endif /* DHCONFIG_H_ */
